package com.leaf.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.leaf.core.service.BrandService;

import cn.itcast.common.page.Pagination;

@Controller
@RequestMapping("brand")
public class BrandController {

	@Autowired
	private BrandService BrandService;

	@RequestMapping(value = "list.do")
	public String list(Model model, String name, Integer isDisplay, Integer pageNo) {

		Pagination pagination = BrandService.getPaginationByQuery(name, isDisplay, pageNo);

		model.addAttribute("pagination", pagination);
		model.addAttribute("name", name);
		model.addAttribute("isDisplay", isDisplay != null ? isDisplay : 1);

		return "brand/list";
	}

}
